<template>
	<el-drawer title="知识文档详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form :model="form" :disabled="mode=='show'" ref="dialogForm" label-width="100px" label-position="left">
					<el-form-item label="知识标题" prop="title">{{ form.title }}</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12"><el-form-item label="所属分类" prop="keywords">{{ form.sortName }}</el-form-item></el-col>
						<el-col :lg="12"><el-form-item label="文件版本" prop="keywords">{{ form.version }}</el-form-item></el-col>
					</el-row>
					<el-form-item label="关联关键词" prop="keywords">{{ form.keywords }}</el-form-item>
					<el-form-item label="知识摘要">
						<div v-html="form.content"></div>
					</el-form-item>
					<el-form-item label="相关附件" prop="attachId">
						<attach-menu :attachIds="form.attachId" :roleFlag="3" :preview="true"></attach-menu>
					</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12"><el-form-item label="创建人" prop="keywords">{{ form.userName }}</el-form-item></el-col>
						<el-col :lg="12"><el-form-item label="创建时间" prop="keywords">{{ form.createTime }}</el-form-item></el-col>
					</el-row>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'

export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu,
	},
	data() {
		return {
			loading: false,
			form: {
				knowledgeId: '',
				title: '',
				sortId: '',
				sortNo: '0',
				sortName: '',
				version: '',
				keywords: '',
				content: '',
				msgType: '',
				attachId: '',
				userName:'',
				createTime:'',
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(model) {
			this.model = model;
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data) {
			this.form.knowledgeId = data.knowledgeId
			this.form.title = data.title
			this.form.sortId = data.sortId
			this.form.sortNo = data.sortNo
			this.form.sortName = data.sortName
			this.form.version = data.version
			this.form.keywords = data.keywords
			this.form.content = data.content
			this.form.userName = data.userName
			this.form.createTime = data.createTime
			this.form.attachId = data.attachId
		},
		async getMyKnowledgeById(data)
		{
			let res = await this.$API.file.knowledge.getMyKnowledgeById.get({knowledgeId:data});
			{
				if(res.code==200)
				{
					this.form.knowledgeId = res.data.knowledgeId
					this.form.title = res.data.title
					this.form.sortId = res.data.sortId
					this.form.sortNo = res.data.sortNo
					this.form.sortName = res.data.sortName
					this.form.version = res.data.version
					this.form.keywords = res.data.keywords
					this.form.content = res.data.content
					this.form.userName = res.data.userName
					this.form.createTime = res.data.createTime
					this.form.attachId = res.data.attachId
				}else
				{
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		}
	}
}
</script>

<style>
</style>
